
<?php $this->headScript()->appendFile($this->publicUrl . "Scripts/formsValidation.js"); ?>
<?php $this->headScript()->captureStart(); ?>
function validateRegisterForm() {
	var registerValidator = new FormValidator('register');
	
	registerValidator.isNotEmpty('username', '<?= $this->translate('isEmpty') ?>');
	registerValidator.isNotShorterThan('username', 
		"<?= $this->validationMessage('stringLengthTooShort', '3') ?>", 3);
	registerValidator.isNotLongerThan('username', 
		"<?= $this->validationMessage('stringLengthTooLong', '50') ?>", 50);
	
	registerValidator.isNotEmpty('password', '<?= $this->translate('isEmpty') ?>');
	registerValidator.isNotShorterThan('password', 
		"<?= $this->validationMessage('stringLengthTooShort', '3') ?>", 3);
	registerValidator.isNotLongerThan('password', 
		"<?= $this->validationMessage('stringLengthTooLong', '50') ?>", 50);
	registerValidator.isSameAs('password',
		"<?= $this->validationMessage('notMatch') ?>", 'password2');
		
	registerValidator.isNotEmpty('email', '<?= $this->translate('isEmpty') ?>');		
	registerValidator.isEmail('email',
		"<?= $this->validationMessage('emailAddressInvalid') ?>");
		
	registerValidator.isNotEmpty('fullName', '<?= $this->translate('isEmpty') ?>');
	registerValidator.isNotEmpty('address', '<?= $this->translate('isEmpty') ?>');
	
	return registerValidator.result;
}

<?php $this->headScript()->captureEnd(); ?>

<h2><?= $this->translate('User Registration') ?></h2>

<?php $this->form->setAttrib('onsubmit', 'return validateRegisterForm();'); ?>
<?php $this->form->setName('register'); ?>
<?= $this->form ?>
